export default {
  color: ['#006dff', '#2acc85'],
  grid: {
    x: '15%'
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: { // 坐标轴指示器，坐标轴触发有效
      type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
    },
    formatter: function (params) {
      let DEFAULT_TIME_UNIT = ['时', '分', '秒']
      let color = ['#006dff', '#2acc85']
      let res = ''
      for (let i = 0; i <= params.length - 1; i++) {
        let Hour = parseInt(params[i].value / 3600) + DEFAULT_TIME_UNIT[0]
        let Minute = parseInt((params[i].value - parseInt(params[i].value / 3600) * 3600) / 60) + DEFAULT_TIME_UNIT[1]
        let Second = (params[i].value % 60) + DEFAULT_TIME_UNIT[2]
        let value = ''
        if ((Hour === '0时') && (Minute === '0分') && (Second === '0秒')) {
          value = Second
        } else {
          value = (Hour === '0时' ? '' : Hour) + (Minute === '0分' ? '' : Minute) + (Second === '0秒' ? '' : Second)
        }
        res += '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' + color[i] + '"></span>' +
                  params[i]['seriesName'] + ' : ' + value + '</br>'
      }
      res = params[0]['axisValue'] + '</br>' + res
      return res
    }
  },
  legend: {
    orient: 'horizontal',
    x: 'center',
    y: 'bottom',
    data: ['男性', '女性'],
    icon: 'circle',
    itemGap: 70
  },
  toolbox: {
    show: true,
    feature: {
      dataView: {show: true, readOnly: false},
      magicType: {show: true, type: ['line', 'bar']},
      restore: {show: true},
      saveAsImage: {show: true}
    }
  },
  graphic: [
    {
      type: 'text',
      left: 'center',
      top: 'middle',
      z: 1,
      style: {
        text: '暂无数据',
        fill: 'transparent'
      }
    }
  ],
  calculable: true,
  xAxis: [
    {
      type: 'category',
      data: [],
      axisLabel: {
        interval: 0
        // 可以设置成 0 强制显示所有标签。
      },
      axisLine: {
        show: false,
        lineStyle: {
          type: 'dashed'
        }
      }
    }
  ],
  yAxis: [
    {
      type: 'value',
      splitLine: {
        lineStyle: {
          type: 'dashed'
        }
      },
      axisLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      axisLabel: {
        formatter: function (value, index) {
          let DEFAULT_TIME_UNIT = ['时', '分', '秒']
          let Hour = parseInt(value / 3600) + DEFAULT_TIME_UNIT[0]
          let Minute = parseInt((value - parseInt(value / 3600) * 3600) / 60) + DEFAULT_TIME_UNIT[1]
          let Second = (value % 60) + DEFAULT_TIME_UNIT[2]
          let time = ''
          if ((Hour === '0时') && (Minute === '0分') && (Second === '0秒')) {
            time = Second
          } else {
            time = (Hour === '0时' ? '' : Hour) + (Minute === '0秒' ? '' : Minute) + (Second === '0秒' ? '' : Second)
          }
          return time
        }
      }
    }
  ],
  series: [
    {
      name: '男性',
      type: 'bar',
      barWidth: '30%',
      data: []
    },
    {
      name: '女性',
      type: 'bar',
      barWidth: '30%',
      data: []
    }
  ]
}
